#include "lua_bind.hh"

int LuaBinder::verbose(lua_State* L) {
    if (!lua_isstring(L, -1)) {
        return 0;
    }
    auto str = lua_tostring(L,-1);
    verblog << "[Script]" << std::string(str) << endlog;
    return 0;
}

int LuaBinder::debug(lua_State * L) {
    if (!lua_isstring(L, -1)) {
        return 0;
    }
    auto str = lua_tostring(L,-1);
    debuglog << "[Script]" << std::string(str) << endlog;
    return 0;
}

int LuaBinder::warning(lua_State * L) {
    if (!lua_isstring(L, -1)) {
        return 0;
    }
    auto str = lua_tostring(L,-1);
    warnlog << "[Script]" << std::string(str) << endlog;
    return 0;
}

int LuaBinder::error(lua_State * L) {
    if (!lua_isstring(L, -1)) {
        return 0;
    }
    auto str = lua_tostring(L,-1);
    errorlog << "[Script]" << std::string(str) << endlog;
    return 0;
}

int LuaBinder::fatal(lua_State * L) {
    if (!lua_isstring(L, -1)) {
        return 0;
    }
    auto str = lua_tostring(L,-1);
    fatallog << "[Script]" << std::string(str) << endlog;
    return 0;
}
